:: 版本
@echo off
setlocal enabledelayedexpansion
:: 版本号文件
set version_file=.version

set "version="
for /f "usebackq delims=" %%a in (%version_file%) do (
    set "version=!content!%%a"
)
echo "version: %version% FROM file: %version_file%"

:input_loop
set /p sim=要构建的算法[pc, pm, tw, yc]?：

if "%sim%"=="pc" (
    echo '构建【PC】'
    docker build -t kclk-sim-pc:%version% -f Dockerfile.PC.dockerfile .
    goto end_loop
) else if "%sim%"=="pm" (
    echo '构建【PM】'
    docker build -t kclk-sim-pm:%version% -f Dockerfile.PM.dockerfile .
    goto end_loop
) else if "%sim%"=="tw" (
    echo '构建【TW】'
    docker build -t kclk-sim-tw:%version% -f Dockerfile.TW.dockerfile .
    goto end_loop
) else if "%sim%"=="yc" (
    echo '构建【YC】'
    docker build -t kclk-sim-yc:%version% -f Dockerfile.YC.dockerfile .
    goto end_loop
) else (
    echo '输入仅限[pc, pm, tw], 请重新输入'
    goto input_loop
)
:end_loop

:: 构建完成，是否保存至本地
set /p save=构建完成，是否保存至本地[y/n]?：
if "%save%"=="y" (
    docker save -o kclk-sim-%sim%_%version%.tar kclk-sim-%sim%:%version%
)

